package com.grj.parking.drools.controller;


import com.grj.parking.drools.config.Result;
import com.grj.parking.drools.domain.SysUser;
import com.grj.parking.drools.service.SysUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/users")
@RequiredArgsConstructor
public class UsersController {

    private final SysUserService sysUserService;

    @GetMapping
    public Result<String> g(){
        return Result.success("hello world");
    }
    @GetMapping("/hello")
    public Result<String> hello(){
        return Result.success("hello world");
    }

    @PostMapping
    public Result<Boolean> list(SysUser sysUser){
        return Result.success(sysUserService.save( sysUser));
    }

}
